#define _CRT_SECURE_NO_WARNINGS 1
#include "string.h"
using namespace std;

void test1()
{
	yh::string s1("abcd");
	cout << s1.c_str() << endl;
	for (size_t i = 0; i < s1.size(); i++)
	{
		cout << s1[i] << " ";
	}
	cout << endl;
	const yh::string s2("zhangwenqing");
	yh::string::const_iterator cit = s2.begin();
	while (cit != s2.end())
	{
		cout << *cit << " ";
		++cit;
	}
	cout << endl;
	yh::string::iterator cit2 = s1.begin();
	while (cit2 != s1.end())
	{
		cout << *cit2 << " ";
		++cit2;
	}
	cout << endl;
}

void test2()
{
	yh::string s1("yhzwq");
	s1.push_back('a');
	for (auto it : s1)
	{
		cout << it << " ";
	}
	cout << endl;
	s1.append("love");
	for (auto it : s1)
	{
		cout << it << " ";
	}
	cout << endl;
}

void test3()
{
	yh::string s3("hello");
	s3 += 'w';
	s3 += "orld";
	for (auto it : s3)
	{
		cout << it << " ";
	}
	cout << endl;

}

void test4()
{
	yh::string s4("hello");
	s4.insert(1, 3,'A');
	s4.insert(1,"awbc");
	for (auto it : s4)
	{
		cout << it << " ";
	}
	cout << endl;
}

void test5()
{
	yh::string s5("hello");
	s5.erase(2, 3);
	for (auto it : s5)
	{
		cout << it << " ";
	}
	cout << endl;
}

void test6()
{
	yh::string s6("hello");
	size_t num = s6.find('e');
	cout << num << endl;
	size_t num2 = s6.find("llo");
	cout << num2 << endl;
}

void test7()
{
	yh::string s1("apple");
	yh::string s2("banana");
	yh::string s3("apple");
	yh::string s4("apple");
	int a = (s1 < s2);
	cout << a << endl;
	int b = (s3 == s4);
	cout << b << endl;
}

void test8()
{
	yh::string s1("apple");
	cout << s1 << endl;
}

int main()
{
	test8();
	return 0;
}